﻿using System;
using System.Web;
using System.Text.RegularExpressions;

namespace Web
{
    public class PageBase : System.Web.UI.Page
    {
       public static string[] map = new string[]{
            "首页",
            "影视",
            "明星",
            "娱乐",
            "时尚",
            "美女",
            "动漫",
            "汽车",
            "社会",
            "风景",
            "桌面",
            "素材",
        };
       public static string[] ddlHome = new string[]{
           "画中画管理",
           "中部四块管理",
           "右侧列表管理"
        };
        public static int StrToInt(object Expression, int defValue)
        {

            if (Expression != null)
            {
                string str = Expression.ToString();
                if (str.Length > 0 && str.Length <= 11 && Regex.IsMatch(str, @"^[-]?[0-9]*$"))
                {
                    if ((str.Length < 10) || (str.Length == 10 && str[0] == '1') || (str.Length == 11 && str[0] == '-' && str[1] == '1'))
                    {
                        return Convert.ToInt32(str);
                    }
                }
            }
            return defValue;
        }
        public static int GetQueryInt(string strName, int defValue)
        {
            return StrToInt(HttpContext.Current.Request.QueryString[strName], defValue);
        }
    }
}
